package com.appspot.codelab.docs.client.repository;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * The GData remote service.
 */
@RemoteServiceRelativePath("doc-rpc")
public interface RepositoryService extends RemoteService {

  boolean projectExists(String project) throws RepositoryServiceException;
	
  boolean createSourceDirectory(String project, String path, String username, String password) throws RepositoryServiceException, RepositoryAuthorizationException;
	
  boolean uploadSourceFile(String project, String path, String username, String password, String contents) throws RepositoryServiceException, RepositoryAuthorizationException;
	  
  boolean uploadProjectFile(String project, String path, String username, String password, String contents, String summary, String[] labels) throws RepositoryServiceException, RepositoryAuthorizationException;
  
  boolean deleteSourceFile(String project, String path, String username, String password) throws RepositoryServiceException, RepositoryAuthorizationException;
  
  boolean renameSourceFile(String project, String path, String newPath, String username, String password) throws RepositoryServiceException, RepositoryAuthorizationException;

  String getSourceFileContents(String project, String path, String revision) throws RepositoryServiceException;
  
  String getSourceDirectory(String project, String path, String revision) throws RepositoryServiceException;

  RepositoryUser getUser();
  
  RepositoryProject getProject(String projectName);
  
  RepositoryProject putProject(String projectName, String projectToken);

  String logout() throws RepositoryServiceException;
  
}
